//package com.googeioextended.youtubebetter;
//
//import com.google.gdata.client.*;
//import com.google.gdata.client.youtube.*;
//import com.google.gdata.data.*;
//import com.google.gdata.data.geo.impl.*;
//import com.google.gdata.data.media.*;
//import com.google.gdata.data.media.mediarss.*;
//import com.google.gdata.data.youtube.*;
//import com.google.gdata.data.extensions.*;
//import com.google.gdata.util.*;
//import java.io.IOException;
//import java.io.File;
//import java.net.URL;
//
//public class YouTubeHandler {
//
//}
//
//
////import java.io.IOException;
////
////import org.apache.http.HttpResponse;
////import org.apache.http.client.ClientProtocolException;
////import org.apache.http.client.ResponseHandler;
////
////import android.net.Uri;
////
/////** * Parses YouTube Entity data and and inserts it into the finch video content * provider. */
////public class YouTubeHandler implements ResponseHandler { 
////	public static final String MEDIA = "media"; 
////	public static final String GROUP = "group"; 
////	public static final String DESCRIPTION = "description"; 
////	public static final String THUMBNAIL = "thumbnail"; 
////	public static final String TITLE = "title";
////
////	public static final String CONTENT = "content";
////
////	public static final String WIDTH = "width"; 
////	public static final String HEIGHT = "height";
////public static final String YT = "yt"; 
////public static final String DURATION = "duration"; 
////public static final String FORMAT = "format";
////public static final String URL = "url"; 
////public static final String THUMB_URL = "thumb_url";
////public static final String MOBILE_FORMAT = "1";
////
////public static final String ENTRY = "entry"; 
////public static final String ID = "id";
////private static final String FLUSH_TIME = "5 minutes"; 
////
////private RESTfulContentProvider mFinchVideoProvider;
////private String mQueryText; private boolean isEntry;
////
////public YouTubeHandler(RESTfulContentProvider restfulProvider, String queryText)
////{
////	mFinchVideoProvider = restfulProvider; 
////	mQueryText = queryText;
////}
////	/* * Handles the response from the YouTube gdata server, which is in the form * of an RSS feed containing references to YouTube videos. */
////public void handleResponse(HttpResponse response, Uri uri) throws IOException
////{
////	try { 
////		int newCount = parseYoutubeEntity(response.getEntity());
////		} catch (IOException ex) {
////			
////		}
////}
////public Object handleResponse(HttpResponse response)
////		throws ClientProtocolException, IOException {
////	// TODO Auto-generated method stub
////	return null;
////}
////
////private int parseYoutubeEntity(HttpEntity entity) throws IOException { InputStream youTubeContent = entity.getContent(); InputStreamReader inputReader = new InputStreamReader(youTubeContent);
////int inserted = 0;
////try { XmlPullParserFactory factory = XmlPullParserFactory.newInstance(); factory.setNamespaceAware(false); XmlPullParser xpp = factory.newPullParser();
////xpp.setInput(inputReader);
////int eventType = xpp.getEventType(); String startName = null; ContentValues mediaEntry = null;
////// iterative pull parsing is a useful way to extract data from // streams, since we dont have to hold the DOM model in memory // during the parsing step.
////while (eventType != XmlPullParser.END_DOCUMENT) { if (eventType == XmlPullParser.START_DOCUMENT) { } else if (eventType == XmlPullParser.END_DOCUMENT) { } else if (eventType == XmlPullParser.START_TAG) {
////startName = xpp.getName(); if ((startName != null)) {
////if ((ENTRY).equals(startName)) { mediaEntry = new ContentValues(); mediaEntry.put(FinchVideo.Videos.QUERY_TEXT,
////}
////mQueryText);
////if ((MEDIA + ":" + CONTENT).equals(startName)) { int c = xpp.getAttributeCount(); String mediaUrl = null; boolean isMobileFormat = false;
////for (int i = 0; i < c; i++) { String attrName = xpp.getAttributeName(i); String attrValue = xpp.getAttributeValue(i);
////if ((attrName != null) && URL.equals(attrName))
////{
////mediaUrl = attrValue;
////{ }
////isMobileFormat = true;
////if ((MEDIA + ":" + THUMBNAIL).equals(startName)) { int c = xpp.getAttributeCount(); for (int i = 0; i < c; i++) {
////String attrName = xpp.getAttributeName(i); String attrValue = xpp.getAttributeValue(i);
////if (attrName != null) { if (FinchVideo.Videos.URL.equals(attrName)) {
////mediaEntry.put( FinchVideo.Videos.THUMB_URL,
////attrValue); } else if (WIDTH.equals(attrName))
////{
////mediaEntry.put( FinchVideo.Videos.THUMB_WIDTH,
////attrValue); } else if (HEIGHT.equals(attrName))
////{
////}
////mediaEntry.put( FinchVideo.Videos.THUMB_HEIGHT,
////attrValue);
////if (ENTRY.equals(startName)) { isEntry = true;
////}
////} } else if(eventType == XmlPullParser.END_TAG) {
////String endName = xpp.getName();
////if (endName != null) { if (ENTRY.equals(endName)) {
////isEntry = false; } else if (endName.equals(MEDIA + ":" + GROUP)) {
////// insert the complete media group inserted++;
//

